package bookstudytest.array;

import java.util.Arrays;
import java.util.Random;

/**
 * 数组前后转换
 * Created by swordbone on 2018/2/12.
 */
public class ArrayExchange {
    public static void main(String[] args) {
//        int[] arr1 = new int[]{1,12,2,3};//不报错
//        int[] arr = new int[];//报错
//        int[] arr = new int[]{};//不报错
        int[] arr = new int[11];
//        init array
        for (int b = 0; b < arr.length; b++) {
            int a = new Random().nextInt(1000);
            arr[b] = a;
        }

        System.out.println(Arrays.toString(arr));
        System.out.println("------------------------------------");
        for (int c = 0; c < arr.length / 2; c++) {
            int d = arr[c];
            arr[c] = arr[arr.length - 1 - c];
            arr[arr.length - 1 - c] = d;
        }

        System.out.println(Arrays.toString(arr));


    }
}
